﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web;

namespace SLIITPro.Core
{
    public class FbConnectionManager
    {
        public static string SessionKey
        {
            get
            {
                return GetFacebookAuthCoockie("session_key");
            }
        }

        private static string GetFacebookAuthCoockie(string cookieName)
        {
            string retString = null;
            string fullCookie = ConfigurationManager.AppSettings["FBApiKey"] + "_" + cookieName;

            if (HttpContext.Current.Request.Cookies[fullCookie] != null)
                retString = HttpContext.Current.Request.Cookies[fullCookie].Value;

            return retString;
        }

        public static bool isConnected()
        {
            return (SessionKey != null);
        }
    }
}
